﻿@using KRM.Core
@{
    var order = ViewBag.Order as tblOrder;
    KRMEntities db = ViewBag.db;
    var refundRequest = ViewBag.RefundRequest as tblKRMRefundRequest;
    var pictures = db.tblKRMRefundPhotoes.Where(a => a.RefundRequestId == refundRequest.RefundRequestID);
}
<script>
    $(function () {
        $('.multi').MultiFile();
    });
</script>
<form class="margin0" method="POST" id="frUploadPhotoRefund" enctype="multipart/form-data">
    <input name="refundRequestId" type="hidden" class="hfrefundrequestid" value="@refundRequest.RefundRequestID"/>
    <div class="row-fluid">
        <div class="span2 bold">Attach Picture</div>
        <div class="span10">
            <input type="file" class="multi" name="picture" />
        </div>
    </div>
    @if (pictures.Any())
    {
        <div class="border-padding10" style="overflow: hidden">
            @foreach (var item in pictures)
            {
                <a href="/rdm/getfile?path=@item.PhotoSrc" title="Click to download">
                    <img src="@item.PhotoSrc" alt="" style="float: left; width: 120px; height: 90px; margin:0 10px 10px 0"/>
                </a>
            }
        </div>
    }
    <div class="clearfix"></div>
</form>
<form class="margin0" method="POST" id="frPartialRefundRequest" enctype="multipart/form-data">
    <input name="refundRequestId" type="hidden" class="hfrefundrequestid" value="@refundRequest.RefundRequestID"/>
    <input name="OrderID" type="hidden" value="@order.OrderID"/>
    <input name="Product" type="hidden" value="@ViewBag.Product"/>

    <div class="row-fluid">
        <div class="span4">
            @Html.Action("ucCheckDate", "OrderView", new { refundQuestionId = 22, refundRequestId = refundRequest.RefundRequestID })
        </div>
        <div class="span4">
            @Html.Action("ucTextListRefund", "OrderView", new { refundQuestionId = 23, refundRequestId = refundRequest.RefundRequestID })
        </div>
    </div>

    <div class="row-fluid">
        <div class="fieldset">
            <div class="row-fluid">
                <div class="span4 bold">
                    <p>
                        Order Number: @order.OrderRef
                    </p>
                    <p>
                        Customer Name: @order.ShippingAddress.FullName
                    </p>
                </div>
                <div class="span3 bold">
                    <p>Order Date: @order.DatePlaced.ToString("dd/MM/yyyy")</p>
                    <p>Postcode: @order.ShippingAddress.Postcode</p>
                </div>
            </div>
            <div class="row-fluid">
                <fieldset class="span6 bold margin0">
                    <legend>Goods Despatched?</legend>
                    <div class="row-fluid">
                        <div class="span6 bold">
                            <label>
                                <input type="radio" class="cbcheck" @(refundRequest.IsDespatched == true ? "checked=checked" : "") value="true"  name="despatched"/>
                                Yes</label>
                        </div>
                        <div class="span6 bold">
                            <label>
                                <input type="radio" class="cbcheck" @(refundRequest.IsDespatched == null || refundRequest.IsDespatched == false ? "checked=checked" : "") value="false"  name="despatched"/>
                                No</label>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div style="color: red; font-weight: normal">
                            Yes: We need to collect the item, so the request will go Pending Collection<br />
                            No: The request goes straight into Pending Refund.
                        </div>
                    </div>
                </fieldset>
                <fieldset class="span6 bold margin0" style="height: 106px;">
                    <legend>Direct Despatch?</legend>
                    <div class="row-fluid">
                        <div class="span6 bold">
                            <label>
                                <input type="radio" class="cbcheck" @(refundRequest.IsDD == true ? "checked=checked" : "") value="true" name="isDD" />
                                Yes</label>
                        </div>
                        <div class="span6 bold">
                            <label>
                                <input type="radio" class="cbcheck" @(refundRequest.IsDD == null || refundRequest.IsDD == false ? "checked=checked" : "") value="false" name="isDD" />
                                No</label>
                        </div>
                    </div>
                </fieldset>
            </div>
            <div class="row-fluid">
                <div class="span4 bold">Product:</div>
            </div>
            <div class="row-fluid">
                <div class="span12 bold">
                    <textarea class="input-block-level">@ViewBag.ProductName</textarea>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span2 bold">
                    Compensation
                </div>
                <div class="span5">
                    <input type="text" class="input-block-level" name="Compensation" value="@ViewBag.Compensation"/>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span2 bold">
                    Reimbursement
                </div>
                <div class="span5">
                    <input type="text" class="input-block-level" name="Reimbursement" value="@ViewBag.Reimbursement"/>
                </div>
            </div>
        </div>
    </div>
</form>
<form method="POST" id="frRefundQuestionTextList">
    <input name="refundRequestId" type="hidden" class="hfrefundrequestid" value="@refundRequest.RefundRequestID"/>
    @foreach (var item in new int[] { 13, 14, 15, 16, 17, 18, 19, 20, 21 })
    {
        var question = db.tblKRMRefundQuestions.Find(item);
        if (question != null)
        {
            switch (question.RefundQuestionType)
            {
                case "Check":
        @Html.Action("ucCheckRefund", "OrderView", new { refundQuestionId = item, refundRequestId = refundRequest.RefundRequestID })
                    break;
                case "TextList":
        @Html.Action("ucTextListRefund", "OrderView", new { refundQuestionId = item, refundRequestId = refundRequest.RefundRequestID })
                    break;
                case "CheckList":
        <div class="row-fluid" style="width: 50%; float: left">
            <div class="span1"></div>
            <div class="span10">
                @Html.Action("ucCheckList", "OrderView", new { refundQuestionId = item, refundRequestId = refundRequest.RefundRequestID })
            </div>
        </div>
                    break;
            }
        }
    }
</form>

<form method="POST" id="frRefundQuestioCheckList">
    <input name="refundRequestId" type="hidden" class="hfrefundrequestid" value="@refundRequest.RefundRequestID"/>
    <div class="fieldset">
        <div class="legend"><span>Cancellation Prevention Check List</span></div>
        <div style="overflow: hidden">
            @foreach (var item in new int[] { 6, 7, 8, 9, 10, 11 })
            {
                var question = db.tblKRMRefundQuestions.Find(item);
                if (question != null)
                {
                    switch (question.RefundQuestionType)
                    {
                        case "Check":
                @Html.Action("ucCheckRefund", "OrderView", new { refundQuestionId = item, refundRequestId = refundRequest.RefundRequestID })
                            break;
                        case "TextList":
                @Html.Action("ucTextListRefund", "OrderView", new { refundQuestionId = item, refundRequestId = refundRequest.RefundRequestID })
                            break;
                        case "CheckList":
                <div class="row-fluid" style="width: 50%; float: left">
                    <div class="span1"></div>
                    <div class="span10">
                        @Html.Action("ucCheckList", "OrderView", new { refundQuestionId = item, refundRequestId = refundRequest.RefundRequestID })
                    </div>
                </div>
                
                            break;
                    }
                }
            }
        </div>
    </div>
</form>

<form method="POST" id="frPartialRefundPriceTextList">
    <input name="refundRequestId" type="hidden" class="hfrefundrequestid" value="@refundRequest.RefundRequestID"/>
    @foreach (var item in new int[] { 29, 30, 31, 33 })
    {
        var question = db.tblKRMRefundQuestions.Find(item);
        if (question != null)
        {
            switch (question.RefundQuestionType)
            {
                case "Check":
        @Html.Action("ucCheckRefund", "OrderView", new { refundQuestionId = item, refundRequestId = refundRequest.RefundRequestID })
                    break;
                case "TextList":
        @Html.Action("ucTextListRefund", "OrderView", new { refundQuestionId = item, refundRequestId = refundRequest.RefundRequestID })
                    break;
                case "CheckList":
        <div class="row-fluid" style="width: 50%; float: left">
            <div class="span1"></div>
            <div class="span10">
                @Html.Action("ucCheckList", "OrderView", new { refundQuestionId = item, refundRequestId = refundRequest.RefundRequestID })
            </div>
        </div>
                
                    break;
            }
        }
    }
</form>
<div class="clearfix"></div>
<div class="row-fluid">
    <div class="span3 bold">Amound To Be Refunded</div>
    <div class="span3 bold">
        <input class="input-block-level" type="text" id="txtPartialAmoundRefunded" value="@String.Format("{0:#.##}", refundRequest.RefundRequestID == 0 ? order.OrderValue : refundRequest.AmountOfRefund)" required="required"/>
    </div>
</div>


